package com.me.waterphase;


public class WaterAction {

	private ACTION_TYPE type;
	
	//In seconds.
	private float actionDuration;
	private float animDuration;
	private float actionRemainingTime;
	private float animRemainingTime;
	
	private boolean isBreakable;
	private boolean allowMovement;
	private boolean isGravitySensitive;
	
	/*
	 * Enumeration of all the possible actions through the game.
	 */
	public static enum ACTION_TYPE
	{
		CLIMB(1);
		
		private int type;
		
		private ACTION_TYPE(int _type){ type = _type;}
		public int getType(){return type;}
	}
	
	private WaterAction(ACTION_TYPE _type, float _actionDuration, float _animDuration, boolean _isBreakable, boolean _allowMovement, boolean _isGravitySensitive)
	{
		type = _type;
		
		actionDuration = _actionDuration;
		actionRemainingTime = _actionDuration;
		
		animDuration = _animDuration;
		animRemainingTime = _animDuration;
		
		isBreakable = _isBreakable;
		allowMovement = _allowMovement;
		isGravitySensitive = _isGravitySensitive;
	}
	
	/*
	 * Method used to create an action (by type).
	 */
	public static WaterAction create(ACTION_TYPE _type)
	{
		WaterAction action = null;
		
		switch(_type)
		{
			case CLIMB:
				action = new WaterAction(_type, 0.075f, 0, true, false, false);
				break;	
		}
		
		return action;
	}
	
	/*
	 * Update internal timers.
	 */
	public void update(float _timeElapsed){
		
		if(actionDuration > 0)
			actionRemainingTime -= _timeElapsed; 
		if(animDuration > 0)
			animRemainingTime -= _timeElapsed;
	}
	
	//Getter.
	public ACTION_TYPE getType(){return type;}
	
	public float getActionDuration(){return actionDuration;}
	public float getAnimDuration(){return animDuration;}
	public float getActionRemainingTime(){return actionRemainingTime;}
	public float getAnimRemaingTime(){return animRemainingTime;}
	
	public boolean isBreakable(){return isBreakable;}
	public boolean allowMovement(){return allowMovement;}
	public boolean isGravitySensitive(){return isGravitySensitive;} 
	
}
